// 导入express框架
const express = require('express')
// 使用express框架的路由
const router = express.Router()
// 导入expressJoi
const expressJoi = require('@escook/express-joi')
// 导入userinfo的路由处理模块
const userHandle = require('../router_handle/userinfo')
// 导入验证规则
const { name_limit, email_limit,password_limit,forgetPassword_limit } = require('../limit/user')
// 上传头像
router.post('/uploadAvatar', userHandle.uploadAvatar)
// 绑定账号
router.post('/bindAccount', userHandle.bindAccount)
// 修改用户密码
router.post('/changePassword',expressJoi(password_limit),userHandle.changePassword)
// 获取用户信息
router.post('/getUserInfo', userHandle.getUserInfo)
// 修改姓名
router.post('/changeName', expressJoi(name_limit), userHandle.changeName)
// 修改性别
router.post('/changeSex', userHandle.changeSex)
// 修改邮箱
router.post('/changeEmail', expressJoi(email_limit), userHandle.changeEmail)
// 验证邮箱与账户
router.post('/varityAccountAndEmail',userHandle.varityAccountAndEmail)
// 忘记密码修改新密码
router.post('/changePasswordLogin', expressJoi(forgetPassword_limit),userHandle.changePasswordLogin)
// 向外暴露路由
module.exports = router